package com.suwish.device.util;

/**
 * 
 * @author Min
 *
 */
public final class Platform {

	public static final String PHONE_BRIDGE_LIB_DIR = "suwish.phone.bridge.lib";
	
	public static final String PHONE_BRIDGE_RESOURCES_DIR = "suwish.phone.bridge.resources";
	
	/**
	 * 
	 * API level
	 */
	public static final String PROP_OR_BUILD_VERSION_SDK = "ro.build.version.sdk";
	/**
	 * 
	 * 固件版本
	 */
	public static final String PROP_OR_BUILD_VERSION_RELEASE = "ro.build.version.release";
	public static final String PROP_OR_BUILD_VERSION_CODENAME = "ro.build.version.codename";
	/**
	 * 
	 * 出场日期
	 * 
	 */
	public static final String PROP_OR_BUILD_DATE = "ro.build.date";
	public static final String PROP_OR_BUILD_DATE_UTC = "ro.build.date.utc";
	/**
	 * 产品型号
	 */
	public static final String PROP_OR_BUILD_PRODUCT = "ro.build.product";
	
	/**
	 * 产品型号
	 */
	public static final String PROP_OR_PRODUCT_MODEL = "ro.product.model";
	/**
	 * 制造商
	 */
	public static final String PROP_OR_PRODUCT_MANUFACTURE = "ro.product.manufacturer";
	public static final String PROP_OR_PRODUCT_CPU_ABI = "ro.product.cpu.abi";
	public static final String PROP_OR_PRODUCT_CPU_ABI2 = "ro.product.cpu.abi2";
	
	public static final String PROP_OR_LOCALE_LANGUAGE = "ro.product.locale.language";
	public static final String PROP_OR_LOCALE_REGION = "ro.product.locale.region";
	/**
	 * 
	 * 固件版本等价于{@link Platform#PROP_OR_BUILD_VERSION_RELEASE}
	 */
	public final static String PROP_BUILD_VERSION = PROP_OR_BUILD_VERSION_RELEASE;
	public static final String PROP_BUILD_API_LEVEL = PROP_OR_BUILD_VERSION_SDK;
	public final static String PROP_BUILD_CODENAME = PROP_OR_BUILD_VERSION_CODENAME;
	private Platform(){}
	/**
	 * 
	 * 获得应用程序的类库文件夹，是指本程序使用的lib和一些第三方库的
	 * 默认路径，为工作目录下面的lib文件夹。
	 * 
	 * @return
	 */
	public static String getAppLibDir(){
		return System.getProperty(PHONE_BRIDGE_LIB_DIR);
	}
	/**
	 * 资源目录
	 * 
	 * @return
	 */
	public static String getAppResourcesDir(){
		return System.getProperty(PHONE_BRIDGE_RESOURCES_DIR);
	}
	/**
	 * 
	 * 获得当前平台的换行符
	 * 
	 * @return
	 */
	public static String getLineSeparator(){
		return System.getProperty("line.separator");
	}
	
	public static String getClassPath(){
		return System.getProperty("java.class.path");
	}
	
	public static String getClassPathSeparator(){
		return isWindows() ? ";" : ":";
	}
	public static String getLibraryPath(){
		return  System.getProperty("java.library.path");
	}
	/**
	 * 
	 * 获得JVM的启动目录，也就是JVM的工作目录
	 * @return
	 */
	public static String getAppDir(){
		return System.getProperty("user.dir");
	}
	/**
	 * 
	 * @return
	 */
	public static String getPlatform(){
		return System.getProperty("os.name");
	}
	public static String getArch(){
		return System.getProperty("os.arch");
	}
	public static String getVersion(){
		return System.getProperty("os.version");
	}
	public static int getAvailableProcessors(){
		return Runtime.getRuntime().availableProcessors();
	}
	/**
	 * 
	 * 是否是WIndows平台
	 * 
	 * @return
	 */
	public static boolean isWindows(){
		return getPlatform().toLowerCase().contains("windows");
	}
	
	public static boolean isUnixLinux(){
		return false;
	}
}
